package com.tianji.controller;

import com.tianji.domain.vo.ChatHistoryVO;
import com.tianji.domain.vo.SessionVO;
import com.tianji.service.ChatSessionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/session")
public class ChatSessionController {
    @Autowired
    private ChatSessionService chatSessionService;

    @PostMapping
    public SessionVO returnQuestion(@RequestParam(value = "n",defaultValue = "3") Integer n) {
        return chatSessionService.returnQuestion(n);
    }
    @GetMapping("/hot")
    public List<SessionVO.Example>  getHotQuestions(Integer n) {
        return chatSessionService.getHotQuestions(n);
    }
    @GetMapping("/history")
    public Map<String, List<ChatHistoryVO>> getHistoryQuestions() {
        return chatSessionService.getHistoryRecord();
    }
}
